<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                xmlns:component="http://java.sun.com/jsf/composite/component"
                template="/templates/template.xhtml">
    <ui:define name="title">
        <h:outputText value="财务专员审核" rendered="#{xhhBillCheckBean.$.billStatus==1}"/>
        <h:outputText value="财务经理审核" rendered="#{xhhBillCheckBean.$.billStatus==2}"/>
    </ui:define>
    <ui:define name="content">
        <h:form>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 ">
                    <div class="ui-g-12 card">
                        <div class="ui-g-12">
                            <h3><b>主体信息</b></h3>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="主体名称"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.companyName}" disabled="true"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="开票内容"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu id="billContent" value="#{xhhBillCheckBean.$.billContent}" disabled="true">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                              noSelectionOption="true"/>
                                <f:selectItems
                                        value="#{xhhBillCheckBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILLING_CONTENT]}"
                                        var="dic"
                                        itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="登记税号"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.taxNumber}" disabled="true"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="发票类型"/>
                        </div>
                        <div class="ui-g-4">
                            <p:selectOneMenu id="billType" value="#{xhhBillCheckBean.$.billType}" disabled="true">
                                <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                              noSelectionOption="true"/>
                                <f:selectItems
                                        value="#{xhhBillCheckBean.dictionaries[DictionaryCode.XHH_SETTLEMENT_BILL_TYPE]}"
                                        var="dic"
                                        itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="开票地址"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.billAddress}" disabled="true"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="开票电话"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.companyPhone}" disabled="true"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="开户支行"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.bankAddress}" disabled="true"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="开户账户"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.bankAccount}" disabled="true"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="开户卡号"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.bankNumber}" disabled="true"/>
                        </div>

                        <div class="ui-g-2">
                            <p:outputLabel value="收件人姓名"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.receiveName}" disabled="true"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="收件人手机"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.receivePhone}" disabled="true"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="收件地址"/>
                        </div>
                        <div class="ui-g-4">
                            <p:inputText value="#{xhhBillCheckBean.$.receiveAddress}" disabled="true"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="开票总金额" style="color: red"/>
                        </div>
                        <div class="ui-g-10">
                            <p:inputNumber value="#{xhhBillCheckBean.$.billAmount}" disabled="true"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="备注"/>
                        </div>
                        <div class="ui-g-10">
                            <p:inputText value="#{xhhBillCheckBean.$.remark}" disabled="true"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel rendered="#{xhhBillCheckBean.$.attachmentUrl!=null}" value="附件"/>
                        </div>
                        <div class="ui-g-10">
                            <p:commandButton rendered="#{xhhBillCheckBean.$.attachmentUrl!=null}" value="下载"
                                             ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);"
                                             icon="fa fa-download">
                                <p:fileDownload value="#{xhhBillCheckBean.onDownloadAttachment(null)}"/>
                            </p:commandButton>
                            <p:commandButton icon="fa fa-eye" value="图片"
                                             process="@this @form" rendered="#{xhhBillCheckBean.$.attachmentUrl!=null}"
                                             oncomplete="PF('annex-image-dialog1').show()">
                            </p:commandButton>
                            <p:panel style="border: none" rendered="#{xhhBillCheckBean.$.attachmentUrl!=null}">
                                <a style="text-decoration: none;cursor: pointer;" href="#{xhhBillCheckBean.$.attachmentUrl}">pdf文件浏览</a>
                            </p:panel>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel rendered="#{xhhBillCheckBean.$.imgAttachmentUrl!=null}" value="附件1"/>
                        </div>
                        <div class="ui-g-10">
                            <p:commandButton rendered="#{xhhBillCheckBean.$.imgAttachmentUrl!=null}" value="下载"
                                             ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);"
                                             icon="fa fa-download">
                                <p:fileDownload value="#{xhhBillCheckBean.onDownloadAttachment('img')}"/>
                            </p:commandButton>
                            <p:commandButton icon="fa fa-eye" value="图片"
                                             process="@this @form" rendered="#{xhhBillCheckBean.$.imgAttachmentUrl!=null}"
                                             oncomplete="PF('annex-image-dialog2').show()">
                            </p:commandButton>
                            <p:panel style="border: none" rendered="#{xhhBillCheckBean.$.imgAttachmentUrl!=null}">
                                <a style="text-decoration: none;cursor: pointer;" href="#{xhhBillCheckBean.$.imgAttachmentUrl}">pdf文件浏览</a>
                            </p:panel>
                        </div>
                        <p:dialog widgetVar="annex-image-dialog1" width="70%" height="600px" fitViewport="true" position="center" style="text-align: center">
                            <h:graphicImage id="annex-image1" url="#{xhhBillCheckBean.$.attachmentUrl}"/>
                        </p:dialog>
                        <p:dialog widgetVar="annex-image-dialog2" width="70%" height="600px" fitViewport="true" position="center" style="text-align: center">
                            <h:graphicImage id="annex-image2" url="#{xhhBillCheckBean.$.imgAttachmentUrl}"/>
                        </p:dialog>
                        <div class="ui-g-12">
                            <h3><b>结算明细</b></h3>
                        </div>

                        <div class="ui-g-12 padding0">
                            <p:dataTable var="record" value="#{xhhBillCheckBean.incomeList}"
                                         rendered="#{xhhBillCheckBean.$.recordType==2}">
                                <p:column headerText="开始时间" style="text-align:center;">
                                    <h:outputText value="#{record.startTime}">
                                        <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="结束时间" style="text-align:center;">
                                    <h:outputText value="#{record.endTime}">
                                        <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="产品名称" style="text-align:center;">
                                    <h:outputText value="#{record.productName}"/>
                                </p:column>

                                <p:column headerText="推广方式" style="text-align:center;">
                                    <h:outputText
                                            value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_SETTLEMENT_SPREAD_MODE,record.spreadMode)}"/>
                                </p:column>
                                <p:column headerText="推广渠道" style="text-align:center;">
                                    <h:outputText
                                            value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_SETTLEMENT_SPREAD_CHANNEL,record.spreadChannel)}"/>
                                </p:column>
                                <p:column headerText="合作模式" style="text-align:center;">
                                    <h:outputText
                                            value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_COOPERATION_MODE,record.copMode)}"/>
                                </p:column>
                                <p:column headerText="结算方式" style="text-align:center;">
                                    <h:outputText
                                            value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_SETTLEMENT_CYCLE,record.settlementMode)}"/>
                                </p:column>

                                <p:column headerText="结算单价(元)" style="text-align:center;">
                                    <h:outputText value="#{record.priceCpa == null ?'-':record.priceCpa}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="结算单价(%)" style="text-align:center;">
                                    <h:outputText value="#{record.priceCps == null?'-':record.priceCps}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="注册数" style="text-align:center;">
                                    <h:outputText value="#{record.registerCount == null ?'-': record.registerCount}"/>
                                </p:column>
                                <p:column headerText="放款金额" style="text-align:center;">
                                    <h:outputText value="#{record.lendAmount == null ?'-': record.lendAmount}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="点击数" style="text-align:center;">
                                    <h:outputText value="#{record.clickCount == null ?'-': record.clickCount}"/>
                                </p:column>
                                <p:column headerText="结算金额" style="text-align:center;">
                                    <h:outputText value="#{record.incomeAmount}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="创建人" style="text-align:center;">
                                    <h:outputText value="#{record.creator}"/>
                                </p:column>
                            </p:dataTable>

                            <p:dataTable var="record" value="#{xhhBillCheckBean.prepayList}"
                                         rendered="#{xhhBillCheckBean.$.recordType==1}">
                                <p:column headerText="充值日期" style="text-align:center">
                                    <h:outputText value="#{record.prepayTime}">
                                        <f:convertDateTime pattern="#{constants:get('DATE_FORMAT')}"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="主体名称" style="text-align:center;">
                                    <h:outputText value="#{record.companyName}"/>
                                </p:column>

                                <p:column headerText="付款方式" style="text-align:center;">
                                    <h:outputText
                                            value="#{xhhBillCheckBean.translate(DictionaryCode.XHH_SETTLEMENT_PAY_MODE,record.payMode)}"/>
                                </p:column>

                                <p:column headerText="充值金额" style="text-align:center;">
                                    <h:outputText value="#{record.prepayAmount}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputText>
                                </p:column>

                                <p:column headerText="付款账户" style="text-align:center;">
                                    <h:outputText value="#{record.payName}"/>
                                </p:column>

                                <p:column headerText="付款账号" style="text-align:center;">
                                    <h:outputText value="#{record.payAccount}"/>
                                </p:column>

                                <p:column headerText="创建人" style="text-align:center;">
                                    <h:outputText value="#{record.creator}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                        <component:workflow-basic workflowBean="#{xhhBillCheckBean}"/>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>